//
//  AllStatusViewController.swift
//  QQ空间
//
//  Created by 叶竞泽 on 2017/5/12.
//  Copyright © 2017年 叶竞泽. All rights reserved.
//

import UIKit

class AllStatusViewController: UIViewController {

    override func viewDidLoad() {
        super.viewDidLoad()

        view.backgroundColor = UIColor.purple
        setupNav()
    }
}

// MARK: - 设置界面
extension AllStatusViewController {
    /// 设置导航栏
    fileprivate func setupNav() {
        let titleView = UISegmentedControl(items: ["全部", "特别关心", "好友动态", "认证空间"])
        titleView.selectedSegmentIndex = 0
        titleView.tintColor = UIColor(colorLiteralRed: 68 / 255, green: 68 / 255, blue: 68 / 255, alpha: 1)
        titleView.setTitleTextAttributes([NSForegroundColorAttributeName: UIColor.black], for: .normal)
        titleView.setTitleTextAttributes([NSForegroundColorAttributeName: UIColor.white], for: .selected)
        titleView.addTarget(self, action: #selector(click(sender:)), for: .valueChanged)
        navigationItem.titleView = titleView
    }
    
    func click(sender: UISegmentedControl) {
        print(sender.selectedSegmentIndex)
    }
}
